import React from 'react';
import style from './style'
import { Avatar } from 'sq-ui';
import cx from 'classnames';
class SelectItem extends React.Component {
    constructor(props) {
        super(props);
        this.displayName = 'SelectItem';
    }
    onClick() {
      this.props.onDel  && this.props.onDel(this.props.index)
    }
    render() {
        const {
          label,
          img,
          notDel,
          noImg,
          className,
        } = this.props
        return (
          <li className={style['select-li']}>
            <div className={cx({
              [style['select-item']]: true,
              [className]: className,
            })}>
              {
                noImg ? null :
                <Avatar
                  style={{ marginRight: '3px' }}
                  width={18}
                  src={img}
                />
              }
              
              <span>{label}</span>
              {notDel ? null : <span className={style['select-del']} onClick={::this.onClick}>×</span>}
            </div>
          </li>
        );
    }
}

export default SelectItem;
